package model.persistence.daos;

import java.util.Collection;

import model.entities.Sector;
import model.persistence.HibernateSessionFactory;

import org.hibernate.Criteria;
import org.hibernate.Session;

public class SectorDAO extends GenericDAO
{
	@SuppressWarnings("unchecked")
	public static Collection<Sector> getAll()
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();
	
	     Criteria c = session.createCriteria(Sector.class);  
	     return c.list();
	}
	
	public static Object getById(int id)
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();
		return session.load(Sector.class, id);
	}
}
